<?php
namespace App\Module\Admin\Service;

use App\Model\User;

class UserService {

    public function search($username,$pagesize){
            $query = User::query()->latest("user_id")->with("score");

            if(!empty($username)){
                $query->where('username','like','%'.$username.'%');
            }

            return $query->paginate($pagesize);
    }

    public function getById($id){
        return User::query()->find($id);
    }
}